package com.gaga.metadata.common.enums;

/**
 * 不允许类型修改种类枚举
 * ColumnDbTypeUpdateNotAllowType
 **/
public enum ColumnDbTypeUpdateNotAllowType {

    VARCHAR_TO_NUMERIC("varchar", "numeric"),

    VARCHAR_TO_DATE("varchar", "date");

    public String getFrom() {
        return from;
    }

    public String getTo() {
        return to;
    }

    private String from;
    private String to;

    ColumnDbTypeUpdateNotAllowType(String from, String to) {
        this.from = from;
        this.to = to;
    }

    public static Boolean allowUpdate(String from, String to) {
        Boolean allowUpdate = true;
        for (ColumnDbTypeUpdateNotAllowType columnDbTypeUpdateType : values()) {
            if (columnDbTypeUpdateType.from.equalsIgnoreCase(from) && columnDbTypeUpdateType.to.equalsIgnoreCase(to)) {
                allowUpdate = false;
            }
        }
        return allowUpdate;
    }
}
